﻿@using EasyAbp.Abp.SettingUi.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@model IEnumerable<SettingHtmlInfo>
@inject IHtmlLocalizer<SettingUiResource> L

@foreach (var group in Model.GroupBy(sd => sd.Group2))
{
    <form method="post" id="@(group.Key)SettingGroup" class="setting-ui">
        <abp-card class="mb-3">
            <abp-card-header>
                <h4>@L[group.Key]</h4>
            </abp-card-header>
            <abp-card-body>
                @foreach (var settingHtmlInfo in group)
                {
                    <div class="mb-3">
                        <label class="form-label" for="@settingHtmlInfo.Name">@settingHtmlInfo.DisplayName</label>
                        @await Html.PartialAsync($"~/Pages/Components/SettingUi/Partials/_{settingHtmlInfo.Type.ToPascalCase()}.cshtml", settingHtmlInfo)
                    </div>
                }
                <hr class="my-3">
                <div>
                    <abp-button type="submit" button-type="Primary" text="@L["Save"].Value" />
                    <abp-button button-type="Warning" text="@L["Reset"].Value" class="reset" />
                </div>
            </abp-card-body>
        </abp-card>
    </form>
}